<template>
  <div class="content-management-container">
    <div class="management-header">
      <h2>内容管理</h2>
      <div class="header-decoration"></div>
    </div>
    
    <div class="management-layout">
      <div class="management-nav">
        <el-menu 
          :default-active="activeMenu" 
          class="management-menu" 
          mode="vertical" 
          router
        >
          <el-menu-item index="/home/contentManagement/articleManagement">
            <template #title>
              <t-icon name="book" />
              <span>文章管理</span>
            </template>
          </el-menu-item>
          
          <el-menu-item index="/home/contentManagement/questionManagement">
            <template #title>
              <t-icon name="help-circle" />
              <span>问题管理</span>
            </template>
          </el-menu-item>
          
          <el-menu-item index="/home/contentManagement/answerManagement">
            <template #title>
              <t-icon name="message-square" />
              <span>回答管理</span>
            </template>
          </el-menu-item>
        </el-menu>
      </div>
      
      <div class="management-content">
        <router-view />
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router';

const route = useRoute();

// 计算当前激活的菜单项
const activeMenu = computed(() => {
  return route.path;
});
</script>

<style scoped>
.content-management-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
  background-color: #f9fafc;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.management-header {
  margin-bottom: 32px;
  position: relative;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.management-header h2 {
  font-size: 2.2rem;
  color: #2c3e50;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: relative;
  display: inline-block;
}

.header-decoration {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, #3498db, #9b59b6);
  border-radius: 3px;
}

.management-layout {
  display: flex;
  gap: 24px;
  min-height: 650px;
  background-color: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.management-nav {
  width: 240px;
  flex-shrink: 0;
  background-color: #f5f7fa;
  border-radius: 10px 0 0 10px;
  padding-top: 12px;
}

.management-menu {
  height: 100%;
  border-right: none;
  background-color: transparent;
}

.management-menu :deep(.el-menu-item) {
  height: 56px;
  line-height: 56px;
  font-size: 16px;
  margin: 4px 12px;
  border-radius: 8px;
  transition: all 0.3s;
}

.management-menu :deep(.el-menu-item:hover) {
  background-color: rgba(52, 152, 219, 0.08);
}

.management-menu :deep(.el-menu-item.is-active) {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(155, 89, 182, 0.1));
  color: #3498db;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.management-menu :deep(.el-menu-item .t-icon) {
  margin-right: 12px;
  font-size: 20px;
  transition: all 0.3s;
}

.management-menu :deep(.el-menu-item:hover .t-icon) {
  transform: translateY(-2px);
}

.management-content {
  flex: 1;
  background-color: #fff;
  padding: 28px;
  min-height: 650px;
  border-radius: 0 10px 10px 0;
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  .management-layout {
    flex-direction: column;
  }
  
  .management-nav {
    width: 100%;
    border-radius: 10px 10px 0 0;
  }
  
  .management-content {
    border-radius: 0 0 10px 10px;
  }
}
</style>
